|
|
|
|
|
|
|
|
If you have problems connecting to a Microsoft SQL Server data source using standard security on a different machine from the Web server, you might receive an error like Connection Open error in the function CreateFile(). This means that the NT account making the connection (usually the I_USR account) does not have sufficient authority on the NT SQL server.  |
|
|
|
|
|
|
|
|
|
|
With what you have read up to this point, you have all of the knowledge necessary to run an ADO database query and display the results in a Web page. However, even a small database like BIBLIO.MDB has many records. Therefore, you need to provide some way to query the database for just the records that the user wants to see, which of course means you need to accept user input. |
|
|
|
|
|
|
|
|
Setting Up a Sample Query Page |
|
|
|
|
|
|
|
|
The <FORM> tag built in to the HTML language allows user input to be sent to the Web server. Let's set up an HTML form, DBQUERY.HTM, that allows the user to enter an author's name to search for. Simply enter the HTML code in Listing 31.3 and save it on the Web server. |
|
|
|
|
|
|
|
|
Listing 31.3 ASPDEMO.ZIPDBQUERY.HTM is a Standard HTML Form |
|
|
|
|
|
|
|
|
<HTML><BODY>
<H1>Biblio Database Search</H1><HR>
<FORM ACTION=dbsearch.asp METHOD=POST>
Enter Author to search for:
<INPUT TYPE=TEXT NAME=txtSearch>
<INPUT TYPE=SUBMIT VALUE="Begin Search">
</FORM>
</BODY></HTML> |
|
|
|
|
|
|
|
|
|
An HTML form consists of different types of <INPUT> tags, which appear in the user's browser as data entry fields. The contents of these fields are sent to the Web server when the user "submits" a form.  |
|
|
|
|
|
|
|
|
|
|
Note that the code in Listing 31.3 is not an ASP page. It contains no VBScript statements and has the standard .HTM extension. It simply submits an HTML form to an ASP page called DBSEARCH.ASP. The purpose of DBSEARCH.ASP, shown in Listing 31.4, is to perform the actual search. |
|
|
|
|
|
|
|
|
Writing DBSEARCH.ASP is fairly easy, as well. You basically have three things to do: |
|
|
|
|
|
|
|
|
1. Retrieve the value the user wants to search for from the form field txtSearch and use it to build a query. |
|
|
|
|
|